/**
 * 将 location 对象转化为路径字符串 (与 parsePath 方法相反)
 * @param {*} location 对象
 * @returns 
 */
export function createPath(location) {
    let { pathname: path = "/", search, hash } = location;
    if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
    if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
    return path;
}

// console.log(createPath({ search: "?a=3&b=4&c=5", hash: "#xxx=456" }))